<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>递归函数</title>
</head>
<body>
  <script>
    function cal(n) {
      if (n === 1) return 1;
      return n*cal(n - 1);
    }
    //计算十的阶乘
    var res = cal(10);
    console.log(res);
  </script>
</body>
</html>